    //
//  IndexViewController.m
//  WRY
//
//  Created by zhong sckj on 10-10-19.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "IndexViewController.h"
#import "CantonDetailView.h"
#import "IndexRightView.h"
#import "IndexLeftView.h"
#import "AppDelegate_iPad.h"
#import "WebPath.h"
#import "CommonJson.h"
#import "CommonView_iPad.h"
#import "EnterpriseListView.h"
#import "DuiJIZhuZView.h"
#import "RootVC_iPad.h"
#import "TimeMethod.h"
#define RIGHTViewHeight 161
#define RIGHTVIEWX 806.0
@implementation IndexViewController
@synthesize markImageView1,markImageView2,markImageView3,markImageView4,markImageView5,markImageView6,markImageView7,markImageView8;
@synthesize markImageView9,markImageView10,markImageView11,markImageView12;
@synthesize graphView,enterListView,btnClose,bizhuangView,duijibtnClose;
@synthesize listData;
@synthesize enterlistButton;
@synthesize rootVc,zhuzView;

- (void)requestForRegion:(NSString *)body methodName:(NSString *)mthod {
	NSString *bodyStr = [NSString stringWithFormat:@"LoginGuid=%@&CantonCodes=%@",[[AppDelegate_iPad currentDelegate] GUID],
                         [[AppDelegate_iPad currentDelegate] userCantonCodes]];
	
	[[CommonJson sharedInstance] requestToPath:[WebPath enterprisePath]
									methodName:mthod 
									bodyString:bodyStr 
									 targetObj:self
							  targetMethodName:@"eventForRequest:"
									notifiName:@"Statistic__EnterpriseCantonRealTime"];
}
- (void)eventForRequest:(NSNotification *)notification {
	[[CommonJson sharedInstance] removeTarget:self notiName:[notification name]];
	NSObject *object  = [notification object];
	if ([object isKindOfClass:[NSDictionary class]]) {
		NSDictionary *dict = (NSDictionary *)object;
		if ([[dict objectForKey:@"Status"] intValue]==1)
		{
			if ([[dict objectForKey:@"Data"] isKindOfClass:[NSArray class]])
			{
				NSArray *data=(NSArray *)[dict objectForKey:@"Data"];
				[listData setArray:data];
				[self drawLeftView];
				[self drawBottonView];
				[self drawGraphView];
			}
		}
		else {
			UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"提示信息" 
														 message:@"服务器连接失败" delegate:self 
											   cancelButtonTitle:@"OK" otherButtonTitles:nil];
			[alert show];
			[alert release];
		}
		
	}
}

-(void)linkData
{
	NSString *methodName=@"Statistic__EnterpriseCantonRealTime";
	[self requestForRegion:@"" methodName:methodName];
}


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	listData=[[NSMutableArray alloc]init];
	CGRect rect=CGRectMake(0, 100, 1024, 648);
	self.view.frame=rect;
	[self initLeftView];
	[self initRightViewBorder];
	[self initRightViewGraph];
	[self initMiddelView];
	[self initBottomView];
    
	[self linkData];
}
-(void)drawLeftView
{
	//将actityview移掉
	if ([self.bizhuangView viewWithTag:10]!=nil)
		[[self.bizhuangView viewWithTag:10]removeFromSuperview];
	if ([self.bizhuangView viewWithTag:200]!=nil)
		[[self.bizhuangView viewWithTag:200]removeFromSuperview];
	IndexLeftView *leftView=[[IndexLeftView alloc]initWithFrame:CGRectMake(82.0, 50.0,600.0,325) 
													  initArray:self.listData];
	leftView.indexViewVc=self;
	[self.bizhuangView addSubview:leftView];
	leftView.tag=200;
	[leftView release];
	
	//左下角的标志
	UIImageView *markImageView=[[UIImageView alloc]initWithFrame:CGRectMake(50, 350, 71,79)];
	[markImageView setImage:[UIImage imageNamed:@"coverflowmark.png"]];
	[self.bizhuangView addSubview:markImageView];
	[markImageView release];
}
-(void)drawBottonView
{
	//将actityview移掉
	if ([self.view viewWithTag:20]!=nil)
		[[self.view viewWithTag:20]removeFromSuperview];
	if ([self.view viewWithTag:300]!=nil)
		[[self.view viewWithTag:300]removeFromSuperview];
	//行政区详情
	CantonDetailView *candetailView=[[CantonDetailView alloc]initWithFrame:CGRectMake(10,486,786,156.0) 
															 initArrayData:self.listData];
	candetailView.tag=300;
	[self.view addSubview:candetailView];
	
	[candetailView release];
}
-(void)drawGraphView
{
	if ([self.graphView viewWithTag:400]!=nil) 
		[[self.graphView viewWithTag:400]removeFromSuperview];
	if ([self.graphView viewWithTag:500]!=nil) 
		[[self.graphView viewWithTag:500]removeFromSuperview];
	if ([self.graphView viewWithTag:600]!=nil) 
		[[self.graphView viewWithTag:600]removeFromSuperview];
	if ([self.graphView viewWithTag:700]!=nil) 
		[[self.graphView viewWithTag:700]removeFromSuperview];
	IndexRightView *rightview=[[IndexRightView alloc]init:self.listData];	
	//画江苏省污染源
	UIView *jiangsuView=[rightview drawsector];
	jiangsuView.frame=CGRectMake(20, 30, 180, 120);
	jiangsuView.tag=400;
	[jiangsuView setUserInteractionEnabled:NO];
    UIButton *wuranyButton=[UIButton buttonWithType:UIButtonTypeCustom];
	wuranyButton.frame=CGRectMake(20, 30, 180, 120);
	wuranyButton.tag=4;
	[wuranyButton addTarget:self action:@selector(eventDetailAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.graphView addSubview:jiangsuView];
	[self.graphView addSubview:wuranyButton];
    
   // [jiangsuView release];
	
	//画污水污染源
	UIView *feishuiView=[rightview drawHistogramView:@"01"];
	feishuiView.frame=CGRectMake(20, 195, 180, 120);
	feishuiView.tag=500;
	[feishuiView setUserInteractionEnabled:NO];
    UIButton *feisbutton=[UIButton buttonWithType:UIButtonTypeCustom];
	feisbutton.frame=CGRectMake(20, 195, 180, 120);
	feisbutton.tag=1;
	[feisbutton addTarget:self action:@selector(eventDetailAction:) forControlEvents:UIControlEventTouchUpInside]; 
	[self.graphView addSubview:feishuiView];
	[self.graphView addSubview:feisbutton];
   // [feishuiView release];
	
	//画废气污染源
	UIView *feiQiView=[rightview drawHistogramView:@"02"];
	feiQiView.frame=CGRectMake(20, 356, 180, 120);
	feiQiView.tag=600;
	[feiQiView setUserInteractionEnabled:NO];
    UIButton *feiqiButton=[UIButton buttonWithType:UIButtonTypeCustom];
	feiqiButton.frame=CGRectMake(20, 356, 180, 120);
	feiqiButton.tag=2;
	[feiqiButton addTarget:self action:@selector(eventDetailAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.graphView addSubview:feiQiView];
	[self.graphView addSubview:feiqiButton];
   // [feiQiView release];
	//画污水厂
	UIView *wushuiChang=[rightview drawHistogramView:@"03"];
	wushuiChang.frame=CGRectMake(20, 516, 180, 120);
	wushuiChang.tag=700;
	[wushuiChang setUserInteractionEnabled:NO];
	UIButton *wushuichangbutton=[UIButton buttonWithType:UIButtonTypeCustom];
	wushuichangbutton.frame=CGRectMake(20, 516, 180, 120);
	wushuichangbutton.tag=3;
	[wushuichangbutton addTarget:self action:@selector(eventDetailAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.graphView addSubview:wushuiChang];
	[self.graphView addSubview:wushuichangbutton];
  //  [wushuiChang release];
	
	[self.enterlistButton setEnabled:YES];
}

-(void)initLeftView
{
	UIImageView *leftframeView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0,10,476)];
	[leftframeView setImage:[UIImage imageNamed:@"indexframe.png"]];
	[self.view addSubview:leftframeView];
	[leftframeView release];
	
	//leftView
    UIView *leftbizhuangView=[[UIView alloc]initWithFrame:CGRectMake(10, 0.0, 786.0, 476)];
	self.bizhuangView=leftbizhuangView;
    [leftbizhuangView release];
	[self.view addSubview:self.bizhuangView];
	
	UIImageView *leftImageView=[[UIImageView alloc]initWithFrame:
								CGRectMake(0, 0.0, 786.0,476)];
	leftImageView.image=[UIImage imageNamed:@"borderframe2.png"];
	[self.bizhuangView addSubview:leftImageView];
	[leftImageView release];
	
	//actityview的加载
	CommonView_iPad *activityView=[[CommonView_iPad alloc]initWithFrame:CGRectMake(1, 0.0,784.0,375)];
	activityView.tag=10;
	[self.bizhuangView addSubview:activityView];
	[activityView showLoading];
	[activityView release];
	
	//企业列表页面
	UIButton *btn=[UIButton buttonWithType:UIButtonTypeRoundedRect];
	[btn setFrame:CGRectMake(600, 430, 180, 40)];
//	[btn setImage:[UIImage imageNamed:@"btn180x40.png"] forState:UIControlStateNormal];
    [btn setBackgroundImage:[UIImage imageNamed:@"btn180x40.png"] forState:UIControlStateNormal];
	[btn addTarget:self 
			action:@selector(enterpriseListGo:) 
    forControlEvents:UIControlEventTouchUpInside];
	self.enterlistButton=btn;
	self.enterlistButton.enabled=NO;
	[self.bizhuangView addSubview:enterlistButton];
	
	
	NSString *datestr=[TimeMethod stringDateByFormat:[NSDate date] timeformat:@"yyyy年MM月dd日"];
	UIButton *titlebtn=[UIButton buttonWithType:UIButtonTypeCustom];
    titlebtn.frame=CGRectMake(10, 10, 400, 40);
	NSString *titleStr=[NSString stringWithFormat:@"%@污染源总体概况\n%@",[[AppDelegate_iPad currentDelegate] showCantonName],datestr];
	[titlebtn setBackgroundImage:[UIImage imageNamed:@"coverflowmenu.png"] forState:UIControlStateNormal];
	[titlebtn setTitle:titleStr forState:UIControlStateNormal];
	[self.bizhuangView  addSubview:titlebtn];
	
}
#pragma mark 初始最右边的view 边框
-(void)initRightViewBorder
{
	UIImageView *rightBorder=[[UIImageView alloc]initWithFrame:CGRectMake(1014, 0, 10, 644)];
	rightBorder.image=[UIImage imageNamed:@"indexframe.png"];
	[self.view addSubview:rightBorder];
    [rightBorder release];
	
	markImageView3=[[UIImageView alloc]initWithFrame:CGRectMake(1014, 0, 10, 29)];
	markImageView3.image=[UIImage imageNamed:@"mark1.png"];
	[self.view addSubview:markImageView3];
	
	markImageView6=[[UIImageView alloc]initWithFrame:CGRectMake(1014, RIGHTViewHeight, 10, 29)];
	markImageView6.image=[UIImage imageNamed:@"mark2.png"];
	[self.view addSubview:markImageView6];
	
	markImageView9=[[UIImageView alloc]initWithFrame:CGRectMake(1014, RIGHTViewHeight*2, 10, 29)];
	markImageView9.image=[UIImage imageNamed:@"mark2.png"];
	[self.view addSubview:markImageView9];
	
	
	markImageView12=[[UIImageView alloc]initWithFrame:CGRectMake(1014, RIGHTViewHeight*3, 10, 29)];
	markImageView12.image=[UIImage imageNamed:@"mark2.png"];
	[self.view addSubview:markImageView12];
	
    
}
#pragma mark -
#pragma mark 初始化右侧的view
-(void)createMenuView:(UIView *)rightV menuTitle:(NSString *)menuTitle
{
		
	UILabel *lbl=[[UILabel alloc]initWithFrame:CGRectMake(26, 5, 182, 20)];
	lbl.text=menuTitle;
	lbl.backgroundColor=[UIColor clearColor];
	lbl.textAlignment=UITextAlignmentLeft;
	lbl.font=[UIFont boldSystemFontOfSize:14.0];
	[rightV addSubview:lbl];
	[lbl release];
	
	UIImageView *pictureView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 29, 208, 132)];
	[pictureView setImage:[UIImage imageNamed:@"borderframe.png"]];
	[rightV addSubview:pictureView];
	[pictureView release];
	
	
}

#pragma mark 右边的图形View
-(void)initRightViewGraph
{
	
	self.graphView=[[UIView alloc]initWithFrame:CGRectMake(RIGHTVIEWX, 0, 208, 644)];
	
	//创建江苏省饼状图
	
	UIImageView *rightWRYView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 208, RIGHTViewHeight)];
	[rightWRYView setUserInteractionEnabled:YES];
	markImageView2=[[UIButton alloc]initWithFrame:CGRectMake(0,0,208,49)];
	markImageView2.tag=4;
	[markImageView2 setBackgroundImage:[UIImage imageNamed:@"menuback2.png"]
							  forState:UIControlStateNormal];
	[markImageView2 addTarget:self action:@selector(eventDetailAction:) forControlEvents:UIControlEventTouchUpInside];
	[rightWRYView addSubview:markImageView2];
	markImageView1=[[UIImageView alloc]initWithFrame:CGRectMake(4, 5, 20, 20)];
	markImageView1.image=[UIImage imageNamed:@"gou.png"];
	[rightWRYView addSubview:markImageView1];
	[self createMenuView:rightWRYView menuTitle:[NSString stringWithFormat:@"%@染源概况",[[AppDelegate_iPad currentDelegate] showCantonName]]];	
	[graphView addSubview:rightWRYView];
    [rightWRYView release];
	
	//创建污水柱状图
	UIImageView *rightFSView=[[UIImageView alloc]initWithFrame:CGRectMake(0,RIGHTViewHeight,208,RIGHTViewHeight)];
	[rightFSView setUserInteractionEnabled:YES];
	markImageView5=[[UIButton alloc]initWithFrame:CGRectMake(0,0,208,49)];
	markImageView5.tag=1;
	[markImageView5 setBackgroundImage:[UIImage imageNamed:@"menuback.png"] forState:UIControlStateNormal];
	[markImageView5 addTarget:self action:@selector(eventDetailAction:) forControlEvents:UIControlEventTouchUpInside];
	[rightFSView addSubview:markImageView5];

	markImageView4=[[UIImageView alloc]initWithFrame:CGRectMake(4, 5, 20, 20)];
	markImageView4.image=[UIImage imageNamed:@"feishuiicon.png"];
	[rightFSView addSubview:markImageView4];
	[self createMenuView:rightFSView menuTitle:@"废水污染源概况"];
	[graphView addSubview:rightFSView];
    [rightFSView release];
	
	
	//创建废气柱状图
	UIImageView *rightFQView=[[UIImageView alloc]initWithFrame:CGRectMake(0,RIGHTViewHeight*2, 208, RIGHTViewHeight)];
	[rightFQView setUserInteractionEnabled:YES];
	markImageView8=[[UIButton alloc]initWithFrame:CGRectMake(0,0,208,29)];
	[markImageView8 setBackgroundImage:[UIImage imageNamed:@"menuback.png"] forState:UIControlStateNormal];
	markImageView8.tag=2;
	[markImageView8 addTarget:self action:@selector(eventDetailAction:) forControlEvents:UIControlEventTouchUpInside];
	[rightFQView addSubview:markImageView8];
	markImageView7=[[UIImageView alloc]initWithFrame:CGRectMake(4, 5, 20, 20)];
	markImageView7.image=[UIImage imageNamed:@"feishuiicon.png"];
	[rightFQView addSubview:markImageView7];
	[self createMenuView:rightFQView menuTitle:@"废气污染源概况"];
	[graphView addSubview:rightFQView];
    [rightFQView release];
	
	
	//污水处理厂
	UIImageView *createWSCLView=[[UIImageView alloc]initWithFrame:CGRectMake(0,RIGHTViewHeight*3, 208, RIGHTViewHeight)];
	createWSCLView.userInteractionEnabled=YES;
	markImageView11=[[UIButton alloc]initWithFrame:CGRectMake(0,0,208,29)];
	[markImageView11 setBackgroundImage:[UIImage imageNamed:@"menuback.png"] forState:UIControlStateNormal];
	markImageView11.tag=3;
	[markImageView11 addTarget:self action:@selector(eventDetailAction:) forControlEvents:UIControlEventTouchUpInside];
	[createWSCLView addSubview:markImageView11];
	markImageView10=[[UIImageView alloc]initWithFrame:CGRectMake(4, 5, 20, 20)];
	markImageView10.image=[UIImage imageNamed:@"feishuiicon.png"];
	[createWSCLView addSubview:markImageView10];
	[self createMenuView:createWSCLView menuTitle:@"污水厂染源概况"];
	[graphView addSubview:createWSCLView];
	[self.view addSubview:graphView];
    [createWSCLView release];
    
}
#pragma mark -
#pragma mark 初始化中间的view
-(void)initMiddelView
{
	UIImageView *middView=[[UIImageView alloc]initWithFrame:CGRectMake(0,476,10,10)];
	[middView setImage:[UIImage imageNamed:@"middleframe.png"]];
	[self.view addSubview:middView];
	[middView release];
}
#pragma mark -
#pragma mark 初始化地面的view
-(void)initBottomView
{
	UIView *bottomView=[[UIView alloc]initWithFrame:CGRectMake(0,486,796,158.0)];
	UIImageView *bottomframeView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0,10,158.0)];
	[bottomframeView setImage:[UIImage imageNamed:@"indexframe.png"]];
	[bottomView addSubview:bottomframeView];
	[bottomframeView release];
	
	UIImageView *bottomImageView=[[UIImageView alloc]initWithFrame:
								  CGRectMake(10,0, 786.0, 158)];
	bottomImageView.image=[UIImage imageNamed:@"bottom.png"];
	[bottomView addSubview:bottomImageView];
	[bottomImageView release];
	[self.view addSubview:bottomView];
	[bottomView release];
	
	
	//actityview的加载
	CommonView_iPad *activityView=[[CommonView_iPad alloc]initWithFrame:CGRectMake(11,380.0,784.0,375)];
	activityView.tag=20;
	[self.view addSubview:activityView];
	[activityView showLoading];
	[activityView release];
	
	
}
#pragma mark 动画效果
-(void)showAnimations:(UIView *)showview showFrame:(CGRect)showrect
		   hiddenView:(UIView *)hiddenview hiddenFrame:(CGRect)hiddenrect
{
	[UIView beginAnimations:nil context:NULL];
	[UIView setAnimationDelegate:self];
	[UIView setAnimationDuration:1.0];
	[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
	[UIView setAnimationRepeatAutoreverses:NO];
	[showview setFrame:showrect];
	[hiddenview setFrame:hiddenrect];
	[UIView commitAnimations];	
}
#pragma mark -
#pragma mark 点击污染源列表按钮
-(void)enterpriseListGo:(id)sender
{
	if (btnClose==nil || btnClose.hidden==YES) 
	{
		
		//应藏图标view
		EnterpriseListView *enterlist=[[EnterpriseListView alloc]initWithFrame:CGRectMake(1025, 10,284, 644) loadFromType:1 entertype:1];
		[enterlist reflurbish:1000 enterType:@""];
		enterlist.rootVc=self.rootVc;
		self.enterListView=enterlist;
		[enterlist release];
		[self.view addSubview:self.enterListView];
		[self.view bringSubviewToFront:self.enterListView];
		
		[self showAnimations:enterListView 
				   showFrame:CGRectMake(730, 0,284, 644) 
				  hiddenView:self.graphView hiddenFrame:CGRectMake(1200, 0, 208, 644)];
		
		if (btnClose==nil) 
		{
			btnClose=[UIButton buttonWithType:UIButtonTypeCustom];
			btnClose.frame=CGRectMake(260, -5, 29, 27);
			[btnClose setImage:[UIImage imageNamed:@"cha.png"] forState:UIControlStateNormal];
			[btnClose addTarget:self action:@selector(closeEnterList:) 
			   forControlEvents:UIControlEventTouchUpInside];
			[self.enterListView addSubview:btnClose];
			
		}
		else 
		{
			[self.enterListView addSubview:btnClose];
			btnClose.hidden=NO;
			[self.enterListView bringSubviewToFront:btnClose];
			
		}
		
	}
}
-(void)closeEnterList:(id)sender
{
	btnClose.hidden=YES;
	[self showAnimations:self.graphView 
			   showFrame:CGRectMake(RIGHTVIEWX, 0, 208, 644) 
			  hiddenView:self.enterListView hiddenFrame:CGRectMake(1200, 0, 208, 644)];
}
#pragma mark -
#pragma mark 修改边框图片
-(void)updatePic
{
	
	markImageView1.image=[UIImage imageNamed:@"feishuiicon.png"];
	[markImageView2 setBackgroundImage:[UIImage imageNamed:@"menuback.png"] forState:UIControlStateNormal];
	markImageView3.image=[UIImage imageNamed:@"mark2.png"];
	markImageView4.image=[UIImage imageNamed:@"feishuiicon.png"];
	[markImageView5 setBackgroundImage:[UIImage imageNamed:@"menuback.png"] forState:UIControlStateNormal];
	markImageView6.image=[UIImage imageNamed:@"mark2.png"];
	markImageView7.image=[UIImage imageNamed:@"feishuiicon.png"];
	[markImageView8 setBackgroundImage:[UIImage imageNamed:@"menuback.png"] forState:UIControlStateNormal];
	markImageView9.image=[UIImage imageNamed:@"mark2.png"];
	markImageView10.image=[UIImage imageNamed:@"feishuiicon.png"];
	[markImageView11 setBackgroundImage:[UIImage imageNamed:@"menuback.png"] forState:UIControlStateNormal];
	markImageView12.image=[UIImage imageNamed:@"mark2.png"];
}
#pragma mark -
#pragma mark 进入堆积桩桩图页面
-(void)eventDetailAction:(id)sender
{
	[self.bizhuangView removeFromSuperview];
	UIButton *btn=(UIButton *)sender;
	//修改右侧的标记
	[self updatePic];
	switch (btn.tag) {
		case 4:
			markImageView1.image=[UIImage imageNamed:@"gou.png"];
			[markImageView2 setBackgroundImage:[UIImage imageNamed:@"menuback2.png"] forState:UIControlStateNormal];
			markImageView3.image=[UIImage imageNamed:@"mark1.png"];
			break;

		case 1:
			markImageView4.image=[UIImage imageNamed:@"gou.png"];
			[markImageView5 setBackgroundImage:[UIImage imageNamed:@"menuback2.png"] forState:UIControlStateNormal];
			markImageView6.image=[UIImage imageNamed:@"mark1.png"];
			break;
		case 2:
			markImageView7.image=[UIImage imageNamed:@"gou.png"];
			[markImageView8 setBackgroundImage:[UIImage imageNamed:@"menuback2.png"] forState:UIControlStateNormal];
			markImageView9.image=[UIImage imageNamed:@"mark1.png"];
			break;
		case 3:
			markImageView10.image=[UIImage imageNamed:@"gou.png"];
			[markImageView11 setBackgroundImage:[UIImage imageNamed:@"menuback2.png"] forState:UIControlStateNormal];
			markImageView12.image=[UIImage imageNamed:@"mark1.png"];
			break;
		default:
			break;
	}
	
	if (btn.tag!=4) 
	{
		if (zhuzView==nil) {
			zhuzView=[[DuiJIZhuZView alloc]initWithFrame:CGRectMake(10, 0.0, 786.0, 476)];
			zhuzView.tag=101;
			zhuzView.rootVc=self.rootVc;
			[self.view addSubview:zhuzView];
			[zhuzView linkData:btn.tag];
		}
		else {
			if ([self.view viewWithTag:101]==nil) {
				[self.view addSubview:zhuzView];
			}
			[zhuzView linkData:btn.tag];
		}

	
		//添加勾标记
		if (duijibtnClose==nil) {
			duijibtnClose=[UIButton buttonWithType:UIButtonTypeCustom];
			duijibtnClose.frame=CGRectMake(770, -5, 29, 27);
			[duijibtnClose setImage:[UIImage imageNamed:@"cha.png"] forState:UIControlStateNormal];
			[duijibtnClose addTarget:self action:@selector(closetuiJIAction:) 
					forControlEvents:UIControlEventTouchUpInside];
			[zhuzView addSubview:duijibtnClose];
		}
		else 
			[zhuzView addSubview:duijibtnClose];
	}
	else {
		[self.view addSubview:bizhuangView];
		[zhuzView removeFromSuperview];
	}

}
#pragma mark -
#pragma mark 关闭柱状图
-(void)closetuiJIAction:(id)sender
{
	[zhuzView removeFromSuperview];
	[self.view addSubview:bizhuangView];
	[self updatePic];
	markImageView1.image=[UIImage imageNamed:@"gou.png"];
	[markImageView2 setBackgroundImage:[UIImage imageNamed:@"menuback.png"] forState:UIControlStateNormal];
	markImageView3.image=[UIImage imageNamed:@"mark1.png"];
}

- (void)dealloc {
	[zhuzView release]; 
	[rootVc release];
	[bizhuangView release];
	[duijibtnClose release];
	[btnClose release];
	[graphView release];
	[enterListView release];
    [enterlistButton release];
	[markImageView1 release];
	[markImageView2 release];
	[markImageView3 release];
	[markImageView4 release];
	[markImageView5 release];
	[markImageView6 release];
	[markImageView7 release];
	[markImageView8 release];
	[markImageView9 release];
	[markImageView10 release];
	[markImageView11 release];
	[markImageView12 release];
	[listData release];
	
	[super dealloc];
}

//-(BOOL)shouldAutorotate
//
//{
//    return YES;
//}
//-(NSUInteger)supportedInterfaceOrientations{
//    
//    return UIInterfaceOrientationMaskLandscape; //UIInterfaceOrientationMaskLandscape、UIInterfaceOrientationMaskAll、UIInterfaceOrientationMaskAllButUpsideDown
//    
//}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Overriden to allow any orientation.
    if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight)
	{
		return YES;
	}
    else 
	{
		return NO;
	}
}


- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}


- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}



@end
